import { Component } from 'react'
export default class Hello extends Component {
  // state 又是挂载到实例上的
  state = {
    list: [
      { name: '尼古拉斯', age: 18, id: 1 },
      { name: '赵四', age: 19, id: 2 },
    ],
    home: '武汉',
  }
  render() {
    // render 中的 this 是实例
    const { list, home } = this.state
    return (
      <>
        <h3>城市：{home}</h3>
        <ul>
          {list.map((item) => (
            <li key={item.id}>{item.name}</li>
          ))}
        </ul>
      </>
    )
  }
}
